package com.gpay.erp.services.purchase.impl;

import com.gpay.erp.core.dao.BaseDao;
import com.gpay.erp.core.dao.page.PagerModel;
import com.gpay.erp.services.purchase.ApplicationSubService;
import com.gpay.erp.services.purchase.bean.Application;
import com.gpay.erp.services.purchase.bean.ApplicationSub;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;

/**
 * Created by Administrator on 2015/10/22 0022.
 */
@Service
public class ApplicationSubServiceImpl implements ApplicationSubService {
    @Resource
    private BaseDao dao;

    public void setDao(BaseDao dao) {
        this.dao = dao;
    }
    @Override
    public int insert(ApplicationSub applicationSub) {
        return dao.insert("applicationSub.insert", applicationSub);
    }

    @Override
    public int delete(ApplicationSub applicationSub) {
        return dao.delete("applicationSub.deleteById", applicationSub);
    }

    @Override
    public int deletes(String[] ids) {
        return 0;
    }

    @Override
    public int update(ApplicationSub applicationSub) {
        return dao.update("applicationSub.update",applicationSub);
    }

    @Override
    public ApplicationSub selectOne(ApplicationSub applicationSub) {
        return null;
    }

    @Override
    public ApplicationSub selectById(String id) {
        return null;
    }

    @Override
    public PagerModel selectPageList(ApplicationSub applicationSub) {
        return dao.selectPageList("applicationSub.selectPageList",
                "applicationSub.selectPageCount", applicationSub);
    }

    @Override
    public List<ApplicationSub> selectList(ApplicationSub applicationSub) {
        return dao.selectList("applicationSub.selectListById", applicationSub);
    }

    @Override
    public int getCount(ApplicationSub applicationSub) {
        return dao.getCount("applicationSub.selectPageCount", applicationSub);
    }

    @Override
    public int updateApplicationSubById(ApplicationSub applicationSub) {
        return dao.update("applicationSub.updateById", applicationSub);
    }
    @Override
    public int updateApplicationSubByFId(ApplicationSub applicationSub) {
        return dao.update("applicationSub.updateByFId", applicationSub);
    }

    @Override
    public List<ApplicationSub> selectListByfid(String f_appid) {
        return dao.selectList("applicationSub.selectListByFid", f_appid);
    }

    @Override
    public String getApplicationSubNumber(String applicationNumber) {
        StringBuffer stringBufferCode = new StringBuffer(
                applicationNumber);
            stringBufferCode.append("00");

        return stringBufferCode.toString();
    }

    @Override
    public HashMap selectTotalByOne(ApplicationSub applicationSub) {
        return (HashMap)dao.selectOne("applicationSub.selectTotalByOne",applicationSub);
    }
}
